Skip to content

refactor: migrate package layout to src/firstrade_platform - #545

Merged
Pigbibi merged 1 commit into
mainfrom
refactor/src-package-layout
Nov 18, 2026
Merged

Pigbibi merged 1 commit into
mainfrom
refactor/src-package-layout

Conversation

@Pigbibi

@Pigbibi Pigbibi commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

AI Assistance

AI coding assistant (Gemini) completed the src/firstrade_platform/ package layout migration, documentation sync, lockfile update, and verification.

What Changed

  • Migrated application/, entrypoints/, notifications/, main.py, decision_mapper.py, runtime_*.py, and strategy_*.py into src/firstrade_platform/ (package-dir = {"" = "src"}, where = ["src"]) with updated Dockerfile, CODEOWNERS, script, and test imports.
  • Removed pytest from [project].dependencies in pyproject.toml, updated [tool.pytest.ini_options].pythonpath to ["src", "."] and [tool.coverage.run].source to ["src/firstrade_platform"], and refreshed uv.lock with uv lock.
  • Updated tests/test_coverage_source_layout.py and the remaining inline import in tests/test_rebalance_service.py, and hardened .github/workflows/ci.yml public configuration scan to verify rg is executable (test -x).
  • Synced README.md, README.zh-CN.md, AGENTS.md, CONTRIBUTING.md, docs/statement-reconciliation.md, docs/statement-reconciliation.zh-CN.md, docs/shared-test-imports.md, and .github/workflows/fee-schedule-check.yml for src/firstrade_platform/ paths and documentation links.
  • Updated .github/dependabot.yml (actions group + chore commit prefix while keeping ignore rules), added .github/scripts/dependabot-policy.json for .github/workflows/ci.yml, added 'build' and 'Merge bypass' self-checks in .github/workflows/engineering-governance.yml, and removed the retired .github/workflows/ft-account-facts-sync-once.yml workflow.

How Verified

  • uv lock --check: resolved cleanly with no drift after uv lock.
  • ruff check --exclude external .: passed with zero lint issues.
  • uv run --no-sync python -m pytest -q -p test_support.pytest_provenance --shared-import-mode installed-lock tests/test_shared_import_contract.py: 3 passed (SHARED_IMPORT_PROVENANCE_COMPLETE).
  • coverage run -m pytest -q + coverage report --show-missing: 1857 passed, 118 subtests passed; 37 files measured strictly under src/firstrade_platform/ (82% total).
  • check_qpk_pin_consistency.py against pinned QuantPlatformKit: all 3 dependency files match the locked revision.
  • python -m build wheel inspection: top-level archive contains only firstrade_platform/ and firstrade_platform-0.3.0.dist-info/.
  • check_style.py --root . --phase 2 and actionlint -shellcheck= -pyflakes=: 0 blocking findings; clean workflow lint.

Why

Adopting a standard src/ package layout prevents root-directory modules from shadowing installed packages and ensures wheel builds ship only firstrade_platform/, while keeping docs, lockfiles, and PR governance rules aligned.

Risk

R2 governance and runtime packaging refactor (scripts/, .github/workflows/, .github/scripts/, src/firstrade_platform/, pyproject.toml, Dockerfile). Offline test suite, wheel packaging, pin consistency, and static checks pass; no deployment, secret mutation, or live execution is performed.

- Move application, entrypoints, notifications, main, and strategy/runtime
  modules into src/firstrade_platform/ with updated setuptools, pytest,
  coverage, Dockerfile, CODEOWNERS, script, and test imports.
- Remove pytest from runtime dependencies in pyproject.toml and refresh
  uv.lock via uv lock.
- Add executable check for rg in CI public configuration scan and fix
  remaining test layout/import checks.
- Sync README.md, README.zh-CN.md, AGENTS.md, CONTRIBUTING.md, and docs/
  for src/firstrade_platform/ paths.
- Update Dependabot actions group/prefix, tighten commitlint rules, add
  dependabot-policy.json, and drop retired ft-account-facts-sync-once.yml.
@Pigbibi Pigbibi added the agent-approved An agent cleared this high-risk change on the current head; not an owner confirmation label Nov 18, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-18T09:18:15.296814Z 2625961 PR opened
🔒 Security Review ✅ Completed 2026-11-18T09:20:13.773217Z 2625961 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Pigbibi
Pigbibi merged commit 9d90f23 into main Nov 18, 2026
15 of 17 checks passed
@Pigbibi
Pigbibi deleted the refactor/src-package-layout branch November 18, 2026 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-approved An agent cleared this high-risk change on the current head; not an owner confirmation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant